/** 表数据处理控件 * */
document.write('<script type="text/javascript" src="' + context
		+ '/system/tablequery/js/tablehandler.js"></script>');

/** 表数据处理控件 * */
document.write('<script type="text/javascript" src="' + context
		+ '/system/tablequery/js/querylist4extN.js"></script>');

function renderOQExtListHeader(value, cellmeta, record, rowIndex, columnIndex,
		store) {
	var cm = OgetGridCm('yrkgzlist');
	var fieldName = cm.getDataIndex(columnIndex);
	if (fieldName == 'CKID') {
		if (value == '1') {
			return '库房一';
		} else if (value == '2') {
			return '库房二';
		}
	} else if (fieldName == 'CKDATE') {
		return formatDate(value);
	} else if (fieldName == 'SP') {
		var resultString = String
				.format(
						'<a title="查看资产入库记录" href="javascript:void(0);" onclick="javascript:handleCK(\'{0}\',\'{1}\',\'{2}\',\'{3}\');">{4}</a>',
						record.data['GZID'], record.data['GZNAME'],
						record.data['TYPENAME'], record.data['GZCODE1'],
						'资产入库记录');
		return resultString;
	}

	return value;
}

function renderTQExtRegionListHeader(value, cellmeta, record, rowIndex,
		columnIndex, store) {
	var cm = getGridCm('gzckrecordlist');
	var fieldName = cm.getDataIndex(columnIndex);

	if (fieldName == 'RKDATE') {
		return formatDate(value);
	}

	return value;
}

/**
 * 查看入库登记记录
 * 
 * @param {}
 *            id 资产id
 * @param {}
 *            name 资产名称
 * @param {}
 *            tname 类型名称
 * @param {}
 *            code 资产编码
 */
function handleCK(id, name, tname, code) {
	initTQExtRegionList('north', 'gzckrecordlist', function(grid) {
				grid.height = 300;

				var win = new Ext.Window({
							id : 'ckwin',
							closable : true,
							resizable : false,
							// maximizable : true,
							width : 600,
							height : 340,
							border : false,
							plain : true,
							modal : true,
							listeners : {
								'show' : function() {

								}
							},
							items : [grid]
						});

				win.show(this);
			}, 15, '&gzid=' + id);
}